import salt.client

def get_minion_status():
    # 创建 Salt 客户端
    client = salt.client.LocalClient()

    # 获取所有 Minion 的状态
    minion_status = client.cmd('*', 'test.ping')

    # 打印结果
    for minion, status in minion_status.items():
        print(f"{minion}: {'Online' if status else 'Offline'}")

if __name__ == "__main__":
    get_minion_status()